package com.example.fp.cgc.mapper

import com.baomidou.mybatisplus.core.mapper.BaseMapper
import com.example.fp.cgc.entity.UserFollow
import org.apache.ibatis.annotations.Delete
import org.apache.ibatis.annotations.Insert
import org.apache.ibatis.annotations.Select

/**
 * 用户关注表的操作
 * @author 蔡
 * @since 2020-02-26
 */
interface UserFollowMapper : BaseMapper<UserFollow> {

    /**
     * 获取关注列表
     */
    @Select("select * from user_follow where uid = #{uid}")
    fun selectFollowList(uid: Int): List<UserFollow>

    /**
     * 查看对某用户是否关注
     */
    @Select("select * from user_follow where uid = #{uid} and oid = #{oid}")
    fun isFollow(uid: Int, oid: Int): List<UserFollow>

    /**
     * 取消关注某用户
     */
    @Delete("delete from user_follow where uid = #{uid} and oid = #{oid}")
    fun deleteFollow(uid:Int,oid:Int)
}